﻿#define  _CRT_SECURE_NO_WARNINGS 1

//每天进步一小点，学习进步一大点

//在牛客网练习编程的第26天：函数的深入理解


//嵌套调⽤：
//计算某年某月有多少天？
//众所周知：2月有28天/29天
//所以就要判断：是否是闰年：能被4整除但不能被100整除,能被400整除的数就叫闰年


#include<stdio.h>
int shi_runnian(int a)
{
	if ((a % 4 == 0 && a % 100 != 0) || (a % 400 == 0))
		return 1;
	else
		return 0;

}

int day_tian(int a,int b)
{
	//需要数组作为支撑，
	int arr[] = {0, 31,28,31,30,31,30,31,31,30,31,30,31 };
	//            0   1  2  3  4  5  6  7  8  9  10 11 12
	int day = arr[b];
	if (shi_runnian(a) && b == 2)
		day += 1;

	return day;
}

int main()
{
	int year = 0;
	int month = 0;

	scanf("%d %d", &year, &month);

	int day = day_tian(year,month);

	printf("day = %d\n", day);
	return 0;
}




//二维数组做函数参数

#include<stdio.h>
int  Print(int brr[3][5],int s,int b)
{
	int i = 0;
	for (i = 0; i < s; i++)
	{
		int v = 0;
		for (v = 0; v < b; v++)
		{
			printf("%d ", brr[i][v]);
		}
		printf("\n");
	}	
}

int main()
{
	int arr[3][5] = { {1,2,3,4,5,},{2,3,4,5,6},{1,3,4,5,6} };
	Print(arr, 3, 5);

	return 0;
}


